<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/WEB-INF/template/globalTemplate.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:define name="title">#{msg['application.titre.utilisateur.demande']}</ui:define>

    <ui:define name="ariane">
        <h:commandLink action="/faces/index.xhtml"  
                       value="#{msg['application.titre.accueil']}"/>
        >
        #{msg['application.titre.utilisateur.demande']}
    </ui:define>

    <ui:define name="content">
        
        <h:panelGroup styleClass="titre">Liste des demandes</h:panelGroup>


        <p:dataTable var="inscription" value="#{userDemandeBean.listInscription}" id="dataTableDemandes" emptyMessage="#{msg['application.emptyMessage']}">  

            <p:column style="width:16px">  
                <p:rowToggler />  
            </p:column>

            <p:column headerText="Personnel" >  
                <h:outputText value="#{inscription.personnel}" />  
            </p:column>  

            <p:column headerText="Domaine" >  
                <h:outputText value="#{inscription.session.formation.domaine.libelle}" />  
            </p:column>  

            <p:column headerText="Formation" >  
                <h:outputText value="#{inscription.session.formation.libelle}" />  
            </p:column>  

            <p:column headerText="Instructeur" >  
                <h:outputText value="#{inscription.session.instructeur}" />  
            </p:column>  

            <p:column headerText="Action" >
                <p:commandLink action="#{userDemandeBean.autoriser(inscription)}"
                               value="Autoriser"  
                               update="globalForm:confirm"/>
                <p:commandLink action="#{userDemandeBean.refuser(inscription)}"
                               value=" Refuser"  
                               update="globalForm:confirm"/>  
            </p:column>
            
            <p:rowExpansion>  
                <h:panelGrid id="display" columns="4" cellpadding="4"  
                             style="width:500px;"  
                             styleClass="ui-widget-content"  
                             columnClasses="label, value">  
                    
                    <p:dataTable value="#{inscription.session.listSeance}" var="uneSeance">
                        
                        <p:column headerText="Séance">
                            <h:outputText value="*" />
                        </p:column>
                        <p:column headerText="Date">
                            <h:outputText value="#{uneSeance.dateHeureDebut}">
                                <f:convertDateTime pattern="dd/MM/yy"/>
                            </h:outputText>
                        </p:column>
                        <p:column headerText="Heure">
                            <h:outputText value="#{uneSeance.dateHeureDebut}">
                                <f:convertDateTime pattern="HH:mm"/>
                            </h:outputText>
                            -
                            <h:outputText value="#{uneSeance.dateHeureFin}">
                                <f:convertDateTime pattern="HH:mm"/>
                            </h:outputText>
                        </p:column>
                        <p:column headerText="Durée">
                            <h:outputText value="#{uneSeance.duree}h"/>
                        </p:column>
                        
                    </p:dataTable>

                </h:panelGrid>  

            </p:rowExpansion> 

        </p:dataTable>


    </ui:define>

    <ui:define name="popup">
    </ui:define>

</ui:composition>
